<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改岗位')" />
    <th:block th:include="include :: header('功能扩展')" />
    <th:block th:include="include :: header('添加文章')" />
    <th:block th:include="include :: bootstrap-fileinput-css" />
    <th:block th:include="include :: jasny-bootstrap-css" />
    <link href="/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="/css/font-awesome.min.css" rel="stylesheet"/>
    <!-- bootstrap-table 表格插件样式 -->
    <link href="/ajax/libs/bootstrap-table/bootstrap-table.min.css" rel="stylesheet"/>
    <link href="/css/animate.css" rel="stylesheet"/>
    <link href="/css/style.css" rel="stylesheet"/>
    <link href="/ruoyi/css/ry-ui.css" rel="stylesheet"/>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="/css/font-awesome.min.css" rel="stylesheet"/>
    <script type="text/javascript" src="/js/jquery.min.js"></script>

</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-post-edit" th:object="${banner}">
        <input id="bannerTitle" name="bannerTitle" type="hidden" th:field="*{bannerId}"/>
        <div class="form-group">
            <label class="col-sm-3 control-label">标题：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="bannerTitle" id="bannerTitle" th:field="*{bannerTitle}" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">文本编辑：</label>
            <div class="col-sm-8">
                <textarea style="height: 100px" id="remark" name="richText" class="form-control">[[*{richText}]]</textarea>
            </div>
        </div>
        <div class="form-group" style="margin-left: 220px">
            <label class="font-noraml">原图片预览</label>
            <br/>
            <div class="fileinput fileinput-new" data-provides="fileinput">
                <div class="fileinput-new thumbnail" style="width: 140px; height: 140px;">
                    <input type="hidden" id="temp" name="temp" th:field="*{coverPhoto}">
                    <img id="photo" alt="图片"/>
                    <script type="text/javascript">
                        $(function () {
                            var temp = $("#temp").val()
                            $("#photo").attr("src","/content/banner/getImageByMysql?filename="+temp);
                        })
                    </script>
                </div>
                <div class="fileinput-preview fileinput-exists thumbnail" style="max-width: 200px; max-height: 150px;"></div>
                <script>
                    $(function () {
                        $("#upload").click(function () {
                            $.post("sdfs",{file:$("#photo").val()})
                        })
                    })
                </script>
            </div>
        </div>

    </form>
    <div class="form-group"  style="width: 480px;margin-left: 220px">
        <label class="font-noraml">新图片上传</label>
        <div class="file-loading">
            <input name="file" class="form-control" id="fileinput-demo-1" type="file" multiple data-min-file-count="1">
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script type="text/javascript">
    var prefix = ctx + "/context/banner";
    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save("/content/banner/edit", $('#form-post-edit').serialize());
        }
    }

    $(document).ready(function () {


        $("#fileinput-demo-1").fileinput({

            'uploadUrl': '/content/banner/add2',

            initialPreviewAsData: true
        });
    });
</script>

<script> var ctx = "\/"; </script>
<th:block th:include="include :: footer" />
<th:block th:include="include :: jasny-bootstrap-js" />
<th:block th:include="include :: bootstrap-fileinput-js" />
</body>
</html>
